<template>
  <div class="app">
    <el-container>
      <el-header>
        <h2>lc个人管理系统</h2>
        <el-button type="info" @click="outlogin()">退出</el-button>
      </el-header>
      <el-container>
        <el-aside :width="iscollapse ? '64px' : '200px'">
          <el-menu
            default-active="2"
            class="el-menu-vertical-demo"
            background-color="#333744"
            unique-opened
            text-color="#fff"
            :collapse="iscollapse"
            router
          >
            <p class="lp1" @click="iscollapse = !iscollapse">|||</p>
            <el-submenu
              v-for="(item, index) in Navigationlists"
              :key="index"
              :index="item.path"
            >
              <template slot="title">
                <i :class="iconsobj[index]"></i>
                <span>{{ item.authName }}</span>
              </template>
              <el-menu-item-group>
                <el-menu-item
                  :index="'/' + ite.path"
                  v-for="(ite, inde) in item.children"
                  :key="inde"
                >
                  <i :class="iconsobj[inde]"></i>
                  {{ ite.authName }}
                </el-menu-item>
              </el-menu-item-group>
            </el-submenu>
          </el-menu>
        </el-aside>
        <el-main>
          <!-- 面包屑
          <el-breadcrumb separator="/">
            <el-breadcrumb-item v-for="(item, index) in $route.matched" :key="index">{{
              item.name
            }}</el-breadcrumb-item>
          </el-breadcrumb> -->
          <router-view></router-view>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>
export default {
  components: {},
  name: "",
  data() {
    return {
      iscollapse: false,
      Navigationlists: [],
      iconsobj: [
        "el-icon-user",
        "el-icon-info",
        "el-icon-goods",
        "el-icon-s-order",
        "el-icon-s-marketing",
      ],
    };
  },
  mounted() {
    this.getNavigationlists();
  },
  methods: {
    //左侧导航栏
    getNavigationlists() {
      this.$axios.get("menus").then((res) => {
        // console.log(res);
        this.Navigationlists = res.data;
        8;
      });
    },
    //退出登录  清空token 跳转登陆页面
    outlogin() {
      window.sessionStorage.removeItem("lc_04B");
      this.$router.push("./llogin");
    },
  },
  computed: {},
  watch: {},
};
</script>

<style lang="scss" scoped>
.app {
  width: 100%;
  height: 100%;
  .el-container {
    width: 100%;
    height: 100%;
    .el-header {
      background-color: #373d41;
      color: white;
      display: flex;
      justify-content: space-between;
      align-items: center;
      .el-button {
        height: 40px;
      }
    }
    .el-container {
      .el-aside {
        background-color: #333744;
        .el-menu {
          border: none;
          // background-color: #333744;
        }
        .lp1 {
          background-color: #4a5064;
          color: white;
          text-align: center;
        }
      }
    }
  }
}
</style>
